
#pragma once

using namespace System::Collections::Generic;

#include "UtilController.h"
#include "UtilityProps.h"
#include "Informations/GlobalInfo.h"

namespace ttg_internal
{
	namespace utils
	{
		///<summary>
		/// Interface of utility. Can be implemented directly or via Utility class.
		///<summary>
		public interface class IUtility
		{
			public:
				///<summary>
				/// Returns name, which will be used for utility comparision.
				///</summary>
				property System::String ^Name;
				///<summary>
				/// Returns name, which will visible for user.
				///</summary>
				property System::String ^ExternalName
				{ System::String ^get(); }
				///<summary>
				/// Returns description of the utility (for user).
				///</summary>
				property System::String ^Description
				{ System::String ^get(); }
				///<summary>
				/// Utility should be inited in this method.
				/// For example, GUI-utility should create a new thread.
				///<summary>
				void Init(UtilityProps ^props, UtilController ^controller, GlobalInfo ^info);
				///<summary>
				/// This method will be called after each pipeline launch.
				/// Step defines approximate time of launch.
				///<summary>
				void Update(float step);
				///<summary>
				/// Utility should be closed in this method.
				///</summary>
				void Close();
				///<summary>
				/// Should return true, if utility is active and visible for user. False otherwise.
				///</summary>
				bool IsActive();
				///<summary>
				/// Should change status from active to unactive (or vice versa).
				/// For example: this method can minimize/maximize window.
				///<summary>
				void ActivateOrDeActivate();
		};
				///<summary>
		/// Wraps Utility and UtilController as pair.
		///</summary>
		private ref class UtilityPlusController
		{
			private:
				IUtility ^_utility;
				UtilController ^_controller;
			public:
				///<summary>
				/// Creates controller for given utility.
				///<summary>
				UtilityPlusController(IUtility ^utility)
				{
					_utility = utility;
					_controller = gcnew UtilController();
				}
				///<summary>
				/// Returns associated utility.
				///</summary>
				property IUtility ^Utility
				{
					IUtility ^get()
					{ return _utility; }
				}
				///<summary>
				/// Returns associated controller.
				///</summary>
				property UtilController ^Controller
				{
					UtilController ^get()
					{ return _controller; }
				}
		};
	}
}
